home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / stdio / c / getw < prev    next >
Text File  |  1996-11-09  |  865b  |  42 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/stdio/c/RCS/getw,v $
  4.  * $Date: 1996/04/19 21:32:42 $
  5.  * $Revision: 1.1 $
  6.  * $State: Rel $
  7.  * $Author: simon $
  8.  *
  9.  * $Log: getw,v $
  10.  * Revision 1.1  1996/04/19 21:32:42  simon
  11.  * Initial revision
  12.  *
  13.  ***************************************************************************/
  14.  
  15. static const char rcs_id[] = "$Id: getw,v 1.1 1996/04/19 21:32:42 simon Rel $";
  16.  
  17. #include <stdio.h>
  18.  
  19. #define INTSIZE 4
  20.  
  21. __STDIOLIB__
  22.  
  23. int
  24. getw (register FILE * f)
  25. {
  26.   register int i;
  27.  
  28.   i = getc (f);
  29.   i |= (getc (f) << 8);
  30. #if INTSIZE > 2
  31.   i |= (getc (f) << 16);
  32.   i |= (getc (f) << 24);
  33. #if INTSIZE > 4
  34.   i |= (getc (f) << 32);
  35.   i |= (getc (f) << 40);
  36.   i |= (getc (f) << 48);
  37.   i |= (getc (f) << 56);
  38. #endif
  39. #endif
  40.   return (ferror (f) ? -1 : i);
  41. }
  42.